-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Add docs for react-router CLI #14148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @markdalgleish!
|
||
## `react-router typegen` | ||
|
||
Generates TypeScript types for your routes. This happens automatically during development, but you can manually run it when needed, e.g. to generate types in CI before running `tsc`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth a cross-link to https://reactrouter.com/explanation/type-safety somewhere in here?
Generates TypeScript types for your routes. This happens automatically during development, but you can manually run it when needed, e.g. to generate types in CI before running `tsc`. | |
Generates TypeScript types for your routes. This happens automatically during development, but you can manually run it when needed, e.g. to generate types in CI before running `tsc`. See [Type Safety][type-safety] for more information. |
|
||
React Router handles the entry points of your application by default. | ||
|
||
If you want to have control over these entry points, you can run `npx react-router reveal` to generate the `entry.client.tsx` and `entry.server.tsx` files in your `app` directory. When these files are present, React Router will use them instead of the defaults. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to have control over these entry points, you can run `npx react-router reveal` to generate the `entry.client.tsx` and `entry.server.tsx` files in your `app` directory. When these files are present, React Router will use them instead of the defaults. | |
If you want to have control over these entry points, you can run `npx react-router reveal` to generate the [`entry.client.tsx`][entry-client] and [`entry.server.tsx`][entry-server] files in your `app` directory. When these files are present, React Router will use them instead of the defaults. |
| `--watch` | Watch for changes | `boolean` | `false` | | ||
|
||
[loaders]: ../../start/framework/data-loading | ||
[vite]: https://vite.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[vite]: https://vite.dev | |
[vite]: https://vite.dev | |
[entry-server]: ../framework-conventions/entry.server.tsx | |
[entry-client]: ../framework-conventions/entry.client.tsx | |
[type-safety]: ../../explanation/type-safety |
As a follow-up to #14144, this is a port of the Remix CLI docs, with all references to Remix updated, and all irrelevant details removed.
I've also added docs for the
reveal
,routes
andtypegen
commands as these were missing in the original docs.